﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace datastruct
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethodStack()
        {
            Stack<int> s = new Stack<int>(2);
            Assert.IsTrue(s.isEmpty());
            s.Push(20);
            Assert.AreEqual(20, s.Peak());
            s.Push(30);
            Assert.AreEqual(30, s.Peak());

            Assert.AreEqual(30, s.Pop());
            Assert.AreEqual(20, s.Pop());

            Assert.IsTrue(s.isEmpty());
        }


        [TestMethod]
        public void TestMethodQueue()
        {
            Queue<int> s = new Queue<int>(2);
            Assert.IsTrue(s.isEmpty());
            s.Enqueue(20);
            s.Enqueue(30);
            Assert.AreEqual(20, s.Dequeue());
            Assert.IsFalse(s.isEmpty());

            Assert.AreEqual(30, s.Dequeue());
            Assert.IsTrue(s.isEmpty());
        }
    }
}
